{extend name="Public:content"}
{block name="content"}
{php}$action = isset($vo['id'])?"edit":"add";{/php}
<form class="form-horizontal m-t" id="addTagForm"  method="post" action='{:url("admin/wechatTags/".$action)}'>
    <div class="form-group">
        <label class="col-sm-2 control-label">标签名称：</label>
        <div class="col-sm-8">
            <input type="text" name="name" value='{$vo.name|default=""}' rangelength="[2,200]" required="true" placeholder="请输入标签名称" title="请输入标签名称" class="form-control">
        </div>
    </div>
    <div class="hr-line-dashed"></div>
    <div class="form-group">
        <div class="col-sm-12 text-center">
            {if isset($vo['id'])}<input type='hidden' value='{$vo.id}' name='id'/>{/if}
            <button class="btn btn-primary" type="submit">保存数据</button>
            <button class="btn btn-primary btn-danger" type='button' data-confirm="确定要取消编辑吗？" onclick="$.Oa.confirm(this)">取消编辑</button>
        </div>
    </div>
</form>
{/block}
{block name="script"}
<script type="text/javascript">
    //表单提交
    $('#addTagForm').validate({
        submitHandler: function(form) {
            $.Oa.doHform('#addTagForm',false,false,function(data){
                parent.layer.msg(data.msg);
                var iframe ='{$iframe}';
                var n = parent.$("iframe[name='"+iframe+"']").index();
                parent[n].$('#table').bootstrapTable('refresh');
                var index = parent.layer.getFrameIndex(window.name);
                parent.layer.close(index);
            })
        }
    })
</script>
{/block}